<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="__ADMIN__css/font.css">
    <link rel="stylesheet" href="__ADMIN__css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__js/jq.js"></script>
    <script type="text/javascript" src="__ADMIN__lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">插件管理</a>
        <a>
          <cite>百度推送</cite></a>
      </span>
</div>
<div class="x-body">
    <fieldset class="layui-elem-field">
        <legend>百度主动推送</legend>
        <div class="layui-field-box">
            <p>主动推送是最为快速的提交方式，建议您将站点当天新产出链接立即通过此方式推送给百度，以保证新链接可以及时被百度收录</p>
            <p>使用主动推送功可以缩短百度爬虫发现您站点新链接的时间，使新发布的页面可以在第一时间被百度收录，使用主动推送功对于网站的最新原创内容</p>
            <p>使用主动推送功能可以快速通知到百度，使内容可以在转发之前被百度发现</p>
            <p>说明：提交前请保证域名和token的准确性，token默认在系统设置中添加</p>
        </div>
    </fieldset>

            <div style="width: 100%;display: flex">
                <div style="width: 80%">
                    <form class="layui-form">
                        <div class="layui-form-item">
                            <label for="web" class="layui-form-label">
                                域名地址：
                            </label>
                            <div class="layui-input-inline">
                                <input type="text"  id="web"  value="<?php echo $_SERVER['SERVER_NAME']; ?>" name="web" required=""
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">默认为本站地址，但也可以为其他网站推送，域名和token必须一致</div>
                        </div>
                        <div class="layui-form-item">
                            <label for="token" class="layui-form-label">
                               推送token：
                            </label>
                            <div class="layui-input-inline">
                                <input type="text"  id="token"  value="{$baidu}" name="token" required=""
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">将网站和百度站长绑定，在链接提交的菜单中所得</div>
                        </div>
                        <div class="layui-form-item">
                            <label for="url" class="layui-form-label">
                                <a onclick="addField(this)" class="field-text" style="color: red" href="###">[+]</a> 地址：
                            </label>
                            <div class="layui-input-block">
                                <input type="text"  id="url"  name="urls[]" required=""  lay-verify="required"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label  class="layui-form-label">
                            </label>
                            <button  class="layui-btn" lay-filter="add" lay-submit="">
                                增加
                            </button>
                        </div>
                    </form>

                </div>

            </div>

        </div>
    <script>
        function addField(o) {
            var attrDiv = $(o).parent().parent();
            var text = $(o).text();
            if (text == "[+]"){
                if ($(".field-text").length ==15){
                    layer.msg('不能再加了！',{icon: 5});
                    return false;
                }
                var newDiv = attrDiv.clone();
                attrDiv.after(newDiv);
                newDiv.find('a').html('[-]');
            }else{
                attrDiv.remove();
            }
        }

        layui.use(['form','layer'], function(){
            $ = layui.jquery;
            var form = layui.form
                ,layer = layui.layer;
            //监听提交
            form.on('submit(add)', function(data){
                $.ajax({
                    type:'post',
                    data:data.field,
                    dataType:'json',
                    url:"{:url('admin/push/pushUrl')}",
                    success:function (data) {
                        layer.msg(data.message);
                    }
                });

            });


        });
    </script>
</body>

</html>